import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
import { getWeekMonthQuarterYear } from '/@/utils';
//列表数据
export const columns: BasicColumn[] = [
   {
    title: '用户ID',
    align:"center",
    dataIndex: 'userId'
   },
   {
    title: '奖励名称',
    align:"center",
    dataIndex: 'name'
   },
   {
    title: '奖励数量',
    align:"center",
    dataIndex: 'goldNum'
   },
   {
    title: '补贴金币',
    align:"center",
    dataIndex: 'subsidyNum'
   },
   {
    title: 'ecpm',
    align:"center",
    dataIndex: 'ecpm'
   },
   {
    title: '请求唯一标识',
    align:"center",
    dataIndex: 'requestId'
   },
   {
    title: '奖励时间',
    align:"center",
    dataIndex: 'bonusTime'
   },
   {
    title: '状态',
    align:"center",
    dataIndex: 'goldStatus'
   },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: '用户ID',
    field: 'userId',
    component: 'Input',
    //colProps: { span: 6 },
  },
  {
    label: '用户账号',
    field: 'username',
    component: 'Input',
    //colProps: { span: 6 },
  },
  {
    label: '查询日期',
    field: 'day',
    component: 'DatePicker',
    componentProps: {
      valueFormat: 'YYYY-MM-DD',
    },
    //colProps: { span: 6 },
  },
];

//查询数据
export const childsearchFormSchema: FormSchema[] = [
  {
    label: '查询日期',
    field: 'day',
    component: 'DatePicker',
    componentProps: {
      valueFormat: 'YYYY-MM-DD',
    },
    //colProps: { span: 6 },
  },
];

//查询数据
export const currentsearchFormSchema: FormSchema[] = [
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '用户ID',
    field: 'userId',
    component: 'Input',
  },
  {
    label: '奖励名称',
    field: 'name',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入奖励名称!'},
          ];
     },
  },
  {
    label: '奖励数量',
    field: 'goldNum',
    component: 'InputNumber',
  },
  {
    label: '请求唯一标识',
    field: 'requestId',
    component: 'Input',
  },
  {
    label: '奖励时间',
    field: 'bonusTime',
    component: 'DatePicker',
    componentProps: {
       showTime: true,
       valueFormat: 'YYYY-MM-DD HH:mm:ss'
     },
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入奖励时间!'},
          ];
     },
  },
  {
    label: '状态',
    field: 'goldStatus',
    component: 'Input',
  },
  {
    label: 'ecpm',
    field: 'ecpm',
    component: 'InputNumber',
  },
  {
    label: 'projectId',
    field: 'projectId',
    component: 'Input',
  },
	// TODO 主键隐藏字段，目前写死为ID
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
];

// 高级查询数据
export const superQuerySchema = {
  userId: {title: '用户ID',order: 0,view: 'text', type: 'string',},
  name: {title: '奖励名称',order: 1,view: 'text', type: 'string',},
  goldNum: {title: '奖励数量',order: 2,view: 'number', type: 'number',},
  requestId: {title: '请求唯一标识',order: 3,view: 'text', type: 'string',},
  bonusTime: {title: '奖励时间',order: 4,view: 'datetime', type: 'string',},
  goldStatus: {title: '状态',order: 5,view: 'text', type: 'string',},
  ecpm: {title: 'ecpm',order: 6,view: 'number', type: 'number',},
  projectId: {title: 'projectId',order: 7,view: 'text', type: 'string',},
};

/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[]{
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}

//列表数据
export const childUserGoldTotalColumns: BasicColumn[] = [
  {
    title: '用户ID',
    align: 'center',
    dataIndex: 'userId',
  },
  {
    title: '用户名称',
    align: 'center',
    dataIndex: 'userName',
  },
  {
    title: '奖励数量',
    align: 'center',
    dataIndex: 'goldNum',
  },
  {
    title: '点击次数',
    align: 'center',
    dataIndex: 'clickCount',
  },
];

//详情页雷彪
export const detailColumns: BasicColumn[] = [
  {
    title: '用户ID',
    align: 'center',
    dataIndex: 'userId',
  },
  {
    title: '用户名称',
    align: 'center',
    dataIndex: 'userName',
  },
  {
   title: '奖励数量',
   align:"center",
   dataIndex: 'goldNum'
  },
  {
   title: '点击次数',
   align:"center",
   dataIndex: 'clickCount'
  },
];

//查询数据
export const dictItemSearchFormSchema: FormSchema[] = [
  
];

//列表数据
export const currentcolumns: BasicColumn[] = [
  {
   title: '用户ID',
   align:"center",
   dataIndex: 'userId',
   width:'140px',
  },
  {
   title: '奖励名称',
   align:"left",
   dataIndex: 'name',
   width:'180px',
  },
  {
   title: '奖励数量',
   align:"center",
   dataIndex: 'goldNum',
   width:'80px',
  },
  {
   title: '补贴金币',
   align:"center",
   dataIndex: 'subsidyNum',
   width:'80px',
  },
  // {
  //  title: 'ecpm',
  //  align:"center",
  //  dataIndex: 'ecpm',
  //  width:'80px',
  // },
  {
   title: '请求唯一标识',
   align:"center",
   dataIndex: 'requestId',
   width:'160px',
  },
  {
    title: '设备标识',
    align:"center",
    dataIndex: 'deviceId',
    width:'160px',
   },
  //  {
  //   title: 'IP',
  //   align: 'center',
  //   dataIndex: 'ip',
  //   width: '160px',
  //  },
  {
   title: '奖励时间',
   align:"center",
   dataIndex: 'bonusTime',
   width:'120px',
  },
];